package com.example.demohello.service.impl;

import com.example.demohello.entity.Student;
import com.example.demohello.mapper.CourseMapper;
import com.example.demohello.mapper.StudentMapper;
import com.example.demohello.service.StudentService;
import com.example.demohello.vo.StudentRequestBo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    StudentMapper studentMapper;
    @Override
    public Student addStudent(Student student) {
        Integer result =  studentMapper.addStudent(student);
        if(result>0)
            return student;
        else return null;
    }

    @Override
    public Integer deleteStudent(Integer studentId) {
        return studentMapper.deleteStudent(studentId);
    }

    @Override
    public List<Student> selectStudent() {
        return studentMapper.selectStudent();
    }

    @Override
    public Student selectOneStudent(Integer studentId) {
        return studentMapper.selectOneStudent(studentId);
    }

    @Override
    public Integer updateStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    @Override
    public List<Student> selectForStudentList(StudentRequestBo requestBo) {
        return studentMapper.selectForStudentList(requestBo);
    }

    @Override
    public Integer selectCountStudent(StudentRequestBo requestBo) {
        return studentMapper.selectCountStudent(requestBo);
    }
}
